#include "comm.hpp"
#include "log.hpp"

int main()
{
    //打开通信文件
    int fd = open(FIFO_FILE, O_WRONLY);
    if (fd < 0)
    {
        perror("open");
        exit(FIFO_OPEN_ERROR);
    }

    std::string line;
    while (true)
    {
        std::cout << "Please Enter: ";
        getline(std::cin, line);
        int n = write(fd, line.c_str(), line.size());

        sleep(1);
    }
    
    //关闭通信文件
    close(fd);

    return 0;
}